M6c: @$var/#$var binding — tuple-stream joins#20
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…l_path_tuple Bind the navigated value under $v without advancing @ (focus freezes the context, making order@$o.product@$p a cross-product), and bind the 0-based result index under $i. Also propagate the tuple stream out of a nested tuple path (a focus/index step the parser wrapped to hold a predicate) so its $v binding survives, and skip undefined operands in comparison type-checks (jsonata returns undefined rather than raising T2010), so the deferred #$pos reorder cases evaluate without crashing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…gressions Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…fidelity The </<=/>/>= operator (reworked in M6c for undefined-operand handling) conflated jsonata's T2010 (operand not number/string) with T2009 (operands of different types). "a" < 3 now raises T2009, matching jsonata-js v2.2.1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements JSONata v2.2.1's
@$var(context/focus binding) and#$var(positional/index binding) path-step operators — the tuple-stream model behind joins — reusing the existing%-parent tuple-stream engine.d950310): register@/#as bp-80 infix ops; validate the variable rhs (S0214); handle them insideflatten_pathso paths stay flat (recurse lhs, markfocus/index/tupleon the last flat step) — leaving keepArray's predicate-nesting untouched. Only@validates step position (S0215 after a predicate, S0216 after a sort);#indexes any step.ffa74af): bind@$vfocus (under$v, without advancing@→ cross-product joins) and#$vindex (0-based) ineval_path_tuple(seeding + main loop); propagate a nested tuple-path's bindings so a predicated focus step (product@$p[…]) keeps$p; make</<=/>/>=return undefined on an undefined operand (faithful to jsonata).bda24c9): regen official-suite record, zero regressions.8661647): comparison type-mismatch ("a" < 3) raises T2009 (not T2010), matching jsonata-js.Results
joinsgroup 4 → 27/43.%/parent/keepArray/predicates byte-identical).@, 3-way joins, global-counter 0-based index, all four error codes (S0214/5/6), and no perturbation of existing paths.Deferred (documented, oracle-confirmed; → M6d)
{…}grouping operator doesn't propagate tuple bindings ($e/$i) into its key/value exprs; blocks ~8employee-map-reducecases (the "reduce" half of map-reduce). Needs a tuple-awareeval_group_step.#($[[1..4]]#$pos[$pos>=2],$^($)#$pos[$pos<3]) needs jsonata's ordered-stagesinterleaving. No crash; returns a structured value.Test plan
busted spec/— 483/0busted spec/jsonata_suite_spec.lua— zero-regression guard greenbash scripts/run-suite.sh— 1237/1682, joins 27/43🤖 Generated with Claude Code